package com.fsp.blog.utils;

import com.fsp.blog.pojo.SysUser;

/**
 * @author fushengping
 * @className UserThreadLocal
 * @description 本地主线程，用来存取用户信息(拦截器监测到用户登录即调用存信息)
 * @date 2021/11/15 22:37
 */
public class UserThreadLocal {
    private  UserThreadLocal() {};
    //局部线程
    private static final ThreadLocal<SysUser> LOCAL = new ThreadLocal<>();

    //存
    public static void put(SysUser sysUser){
        LOCAL.set(sysUser);
    }
    public static SysUser get(){
        return LOCAL.get();
    }
    public static void remove(){
        LOCAL.remove();
    }

}
